#include "button.h"
#include "widget_factory.h"

using namespace krryn::gui;

button::button(const with &a_Initializer)
: widget(create_widget_base<impl>()){

	m_Pimpl = get_impl<impl>();
	m_Pimpl->make(a_Initializer);
	m_Pimpl->post_make(*this, a_Initializer.get_parent());
}

void *button::handle(){
	return m_Pimpl->handle();
}

button_initializer::button_initializer() : m_Text("krryn::button") {
	width(75);
	height(23);
}

button_initializer::button_initializer(const properties &a_Props) : widget_initializer(a_Props) {
	if(!a_Props.has("width")) width(75);
	if(!a_Props.has("height")) height(23);

	text(a_Props.get<std::string>("text", "krryn::button"));
}

button_initializer &button_initializer::text(const std::string &a_Text) { m_Text = a_Text; return *this; }

button* button_initializer::create(){
	return new button(*this);
}